<!-- 专题页 -->
<template>
  <div class="zhuanti">
    <div class="box" v-for="item in data" :key="item.id">
      <img :src="item.scene_pic_url" alt="" />
      <div class="title">{{ item.title }}</div>
      <div class="tip">{{ item.subtitle }}</div>
      <div class="price">{{ item.price_info | moneyFlrmat }}</div>
    </div>

    <!-- 分页器 -->
    <van-pagination
      v-model="currentPage"
      :page-count="totalPages"
      mode="simple"
      @change="ChangeFn"
    />
  </div>
</template>

<script>
import { getTopicList } from "@/https/http.js";

export default {
  data() {
    return {
      currentPage: 1, //当前页
      pageSize: 10, // 每页的条数
      data: [], //数据
      totalPages: "2", //总页数
    };
  },

  methods: {
    getPage() {
      getTopicList({
        page: this.currentPage,
        size: this.pageSize,
      }).then((res) => {
        console.log("res555", this.currentPage);

        console.log("res555", res);
        let { count, currentPage, data, pageSize, totalPages } = res.data;
        this.currentPage = currentPage; //当前页
        this.data = data; //数据
        this.totalPages = totalPages; //总页数
        this.pageSize = pageSize; // 每页的条数
        // 返回顶部
        document.documentElement.scrollTop = 0;
      });
    },
    ChangeFn() {
      // 会直接改变currentPage
      console.log(this.currentPage);
      this.getPage();
    },
  },
  created() {
    this.getPage();
  },
};
</script>
<style lang="less" scoped>
/deep/.van-pagination__page-desc {
  display: none;
}
.zhuanti {
  padding-bottom: 100px;
  box-sizing: border-box;
  .box {
    width: 100%;
    font-size: 14px;
    line-height: 40px;
    text-align: center;
    img {
      width: 100%;
    }
    .title {
      font-size: 18px;
    }
    .price {
      color: red;
    }
  }
}
</style>